package com.hongyue.dey05;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Demo {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.67.129", 11111);
        OutputStream os = s.getOutputStream();
        FileInputStream fis = new FileInputStream("D:\\jiuye\\dey15\\bg3.jpg");
        byte[] bys = new byte[1024];
        for (int i; (i = fis.read(bys)) != -1; ) {
            os.write(bys, 0, i);
        }
        s.shutdownOutput();
        InputStream is = s.getInputStream();
        byte[] bys1 = new byte[1024];
        int read = is.read(bys1);
        System.out.println(new String(bys1, 0, read));
        s.close();
    }
}
